<template>
  <div>
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>组织结构</span>
        <el-divider></el-divider>
        <div class="card-box">
          <div class="card-hader">
            <i class="el-icon-s-promotion"></i>
            <span>小凡人力公司 </span>
            <span class="card-hader-manager">负责人</span>
            <el-dropdown @command="departmentOfAdd">
              <span class="el-dropdown-link">
                操作<i class="el-icon-arrow-down el-icon--right"></i>
              </span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item command="{ b: 'add',}"
                  >添加部门</el-dropdown-item
                >
              </el-dropdown-menu>
            </el-dropdown>
          </div>
          <el-divider></el-divider>
          <el-tree
            :data="views_department"
            icon-class="el-icon-arrow-right"
            :render-content="renderContent"
          >
          </el-tree>
        </div>
      </div>
    </el-card>
    <!-- 编辑对话框 -->
    <el-dialog title="编辑部门" :visible.sync="dialogFormVisible">
      <el-form
        :model="addForm"
        :rules="rules"
        ref="ruleForm"
        label-width="80px"
      >
        <el-form-item label="部门名称" prop="name">
          <el-input
            v-model="addForm.name"
            placeholder="请输入部门名称"
          ></el-input>
        </el-form-item>
        <el-form-item label="部门编码" prop="code">
          <el-input
            v-model="addForm.code"
            placeholder="请输入部门编码"
          ></el-input>
        </el-form-item>

        <el-form-item label="负责人">
          <el-select v-model="addForm.manager" placeholder="请输入负责人">
            <el-option
              :label="item.username"
              :value="item.username"
              v-for="item in simpleList"
              :key="item.id"
            ></el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="部门介绍">
          <el-input
            type="textarea"
            v-model="addForm.introduce"
            placeholder="请输入部门介绍"
          ></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="noneDialog('ruleForm')">取 消</el-button>
        <el-button
          type="primary"
          @click="
            loginInfo.b !== 'see'
              ? appendDepartment('ruleForm')
              : editDepartment('ruleForm')
          "
          >确 定</el-button
        >
      </div>
    </el-dialog>
    <!-- 删除对话框 -->
    <el-dialog title="提示" :visible.sync="delDialog" width="30%" center>
      <span>您确定删除吗</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="delDialog = false">取 消</el-button>
        <el-button type="primary" @click="delDer">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script src='./main.js'>
</script> 



<style lang='less' scope>
.leftDepartment {
  position: absolute;
  left: 5px;
}
.el-tree-node__content {
  display: block;
}
.card-box {
  padding: 30px 120px 0;
}
.card-hader {
  font-size: 14px;
  color: #000;
  position: relative;
  .el-dropdown {
    position: absolute;
    right: 5px;
    font-size: 14px;
    margin-left: 10px;
    cursor: pointer;
    color: #000;
  }
  .card-hader-manager {
    position: absolute;
    right: 55px;
  }
}
.el-divider--horizontal {
  margin: 5px 0;
}
.contents {
  font-size: 14px;
  color: #000;
}

.operation {
  position: absolute;
  right: 5px;
  font-size: 14px;
  color: #000;

  .manager {
    font-size: 10px;
    color: #000;
  }
  .el-dropdown-link {
    font-size: 14px;
    margin-left: 10px;
    cursor: pointer;
    color: #000;
  }
  .el-icon-arrow-down {
    font-size: 12px;
  }
}
</style>